<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of WebUser
 *
 * @author FAISAL
 */
class WebUser extends CWebUser{

    public function isAdmin(){
        return $this->name == 'admin';
    }

    public function isMember(){
        $name = Yii::app()->user->name;
        $record = Member::model()->findAllByAttributes(array('Username'=>$name));
        return ($record != null);
    }

    public function isCSO(){
        return $this->name == 'CSO';
    }

    public function isAO(){
        return $this->name == 'AO';
    }

    public function isSV(){
        return $this->name == 'SV';
    }

    public function isGM(){
        return $this->name == 'GM';
    }

    public function isMD(){
        return $this->name == 'MD';
    }

    public function isCustomer(){
        $name = Yii::app()->user->name;
        $record = Pelanggan::model()->findAllByAttributes(array('Username'=>$name));
        return ($record != null);
    }
}
